package com.steam.xbcc.controller;

import com.steam.xbcc.dto.AlipayNotifyDto;
import com.steam.xbcc.dto.PayParamDto;
import com.steam.xbcc.result.JSONResult;
import com.steam.xbcc.service.IPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private IPayService payService;

    @RequestMapping(value = "/checkPayOrder/{orderNo}",method = RequestMethod.GET)
    public JSONResult checkPayOrder(@PathVariable("orderNo")String orderNo){
        return payService.checkPayOrder(orderNo);
    }

    @RequestMapping(value = "/apply",method = RequestMethod.POST)
    public JSONResult apply(@RequestBody PayParamDto payParamDto){
        return JSONResult.success(payService.apply(payParamDto));
    }

    @RequestMapping(value = "/alipay/notify", method = RequestMethod.POST)
    public String alipayNotify(AlipayNotifyDto alipayNotifyDto){
        return payService.alipayNotify(alipayNotifyDto);
    }
}
